﻿// <copyright file="InterfaceAffector.cs" company="Beuth Hochschule für Technik">
// Breakdown - Configure your Windows 7 Firewall
// Copyright (C) 2009 Stefan "dersteps@gmail.com" Matyba
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; 
// either version 3 of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
// </copyright>
// <author>Stefan Matyba</author>
// <email>dersteps@gmail.com</email>
// <date>2009-10-18</date>
// <summary>Breakdown Application Logic - Implementation of IInterfaceAffector for default use</summary>

namespace Breakdown.Logic
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Breakdown.Aspects;
    using Ninject.Core;

    /// <summary>
    /// Implements the IInterfaceAffector interface and represents the part of a firewall rule that affects only certain types of interfaces
    /// </summary>
    [Logged]
    public class InterfaceAffector : IInterfaceAffector
    {
        /// <summary>
        /// If true, this Interface Affector affects LAN interfaces
        /// </summary>
        private bool _lan = true;

        /// <summary>
        /// If true, this Interface Affector affects wireless interfaces
        /// </summary>
        private bool _wireless = true;

        /// <summary>
        /// If true, this Interface Affector affects remote interfaces
        /// </summary>
        private bool _remote = true;

        /// <summary>
        /// Initializes a new instance of the InterfaceAffector class 
        /// </summary>
        /// <param name="lan">Determines whether LAN interfaces are affected</param>
        /// <param name="wireless">Determines whether Wireless interfaces are affected</param>
        /// <param name="remote">Determines whether remote interfaces are affected</param>
        public InterfaceAffector(bool lan, bool wireless, bool remote)
        {
            this._lan = lan;
            this._wireless = wireless;
            this._remote = remote;
        }

        /// <summary>
        /// Initializes a new instance of the InterfaceAffector class
        /// </summary>
        public InterfaceAffector() : this(true, true, true)
        {
        }

        /// <summary>
        /// Gets or sets a value indicating whether or not the Interface Affector affects LAN interfaces
        /// </summary>
        public bool AffectsLan
        {
            get { return this._lan; }
            set { this._lan = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether or not the Interface Affector affects wireless interfaces
        /// </summary>
        public bool AffectsWireless
        {
            get { return this._wireless; }
            set { this._wireless = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether or not the Interface Affector affects remote interfaces
        /// </summary>
        public bool AffectsRemote
        {
            get { return this._remote; }
            set { this._remote = value; }
        }

        /// <summary>
        /// Gets a value indicating whether or not the Interface Affector affects all interface types
        /// </summary>
        public bool AffectsAll
        {
            get
            {
                return this._lan && this._remote && this._wireless;
            }                
        }
    }
}
